<#include "../common/layout.ftl"/>
<@layout>
<div width="100%">
	<div class="dxfsqd_title">客户会员</div>
	<div class="dxfsqd_shearch">
	<form method="post" action="/member" class="form-inline">
		<#if session.userRole == 'admin' || session.userRole == 'brandManager'>
			<label><span>姓名：</span><input type="text" class="input-medium" style="height: 30px"  name="real_name" value="${real_name?if_exists}"/></label> 
			<label><span>手机号码：</span><input type="text" class="input-medium" style="height: 30px"  name="cell_phone" value="${cell_phone?if_exists}"/></label> 
			<button type="submit" class="btn btn-primary"><i class="icon-search icon-white"></i>查询</button>
			<button type="button" class="btn btn-info" onclick="javascript:history.back();">返回</button>
		</#if>
		<#if session.userRole == 'admin' || session.userRole == 'brandManager' || session.userRole == 'middleManager' || session.userRole == 'customerCenter'>
			<a  style="background: red;" href="/member/add"><i class="icon-user icon-white"></i>添加会员</a>
		</#if>	
		<#if session.userRole == 'admin' || session.userRole == 'brandManager'>
			<label><span>导出</span><a class="dc_exc" href="/member/exportXls?job_number=${jobNumber!''}&real_name=${realName!''}&cell_phone=${cellPhone!''}">导出Excel文件</a></label>
	    </#if>
	</form>
  </div>

<div class="dxfsqd_table">

	<table class="table table-bordered table-striped">
		<thead>
		  <tr>
			<th scope="col">ID</th>
			<th scope="col">姓名</th>
			<th scope="col">手机号码</th>
			<th scope="col">性别</th>
			<!--<th>车牌号码</th>-->
			<th scope="col">订单量</th>
			<th scope="col">订单额</th>
			<th scope="col">注册时间</th>
			<th scope="col">状态</th>
			<th scope="col">操作</th>
		  </tr>
		</thead>
		<tbody>
		<#list page.list as member>
		  <tr>
			<td>
			  <span class="label">${member.id}</span>
			</td>
			<td>
			  ${member.real_name}
			</td>
			<td>
			  ${member.cell_phone}
			</td>
			<td>
			  <#if member.sex == 0>
			  	<span class="label label-info">男</span>
			  <#elseif member.sex == 1>
			  	<span class="label label-warning">女</span>
			  <#else>
			  	<span class="label label-inverse">未知</span>
			  </#if>
			</td>
			
			<td>
			  ${member.order_count!""}
			</td>
			<td>
			  ${member.sum_money!"0"}
			</td>
			<td>
			   <#if member.create_time??> 
			    ${member.create_time?string("yyyy年MM月dd日HH时mm分ss秒") }  
			   </#if>  
			</td>
			<td>
			  <#if member.status == 1>
			  	<span class="label label-success">正常</span>
			  <#elseif member.status == 2>
			  	<span class="label label-inverse">黑名单</span>
			  <#else>
			  	<span class="label label-info">已删除</span>
			  </#if>
			</td>
			<td>
				<div class="btn-group">
					 <#if session.userRole == 'admin' || session.userRole == 'brandManager' || session.userRole == 'middleManager' || session.userRole == 'customerCenter'>
					 	<a class="cf" href="/order/memberOrder/${member.id}"><i class="icon-leaf icon-white"></i> 以前订单</a>
					 </#if>
					 <a class="cf" href="/member/edit/${member.id}"><i class="icon-info-sign icon-white"></i> 修 改</a>
					 <#if session.userId == 1>
					 <a class="cf" href="/member/delete/${member.id}"><i class="icon-trash icon-white"></i> 删 除</a>
					 </#if>
					 <#if session.userRole == 'admin' ||session.userRole == 'brandManager' >
					 	<#if member.status==1>
					 		<a class="cf" href="/member/black/${member.id}"><i class="icon-trash icon-white"></i> 黑名单</a>
					 	<#elseif member.status==2>
					 		<a class="cf" href="/member/white/${member.id}"><i class="icon-trash icon-white"></i> 白名单</a>
					 	</#if> 
					 </#if>
					 <#if session.userRole == 'admin' || session.userRole == 'brandManager' || session.userRole == 'middleManager' || session.userRole == 'customerCenter'>
					 	<a class="cf" href="/member/toVIP/${member.id}"><i class="icon-vip icon-white"></i> 转个人VIP</a>
					 </#if>
					 <#if session.userRole == 'admin' || session.userRole == 'brandManager' || session.userRole == 'middleManager' || session.userRole == 'customerCenter'>
					 	<a class="cf" href="/menber/bussinessVIP/${member.id}"><i class="icon-vip icon-white"></i> 转企业VIP</a>
					 </#if>
				</div>
			</td>
		  </tr>
		</#list>
		</tbody>
	</table>  
	<#include "../common/paginate.ftl" />
	<@paginate currentPage=page.pageNumber totalPage=page.totalPage actionUrl="/member/" />
</div>
</div>
          
</@layout>